src: fix out-of-bounds write when transcoding odd-length ucs2#64512
Open
Nashit-h wants to merge 1 commit into
Open
src: fix out-of-bounds write when transcoding odd-length ucs2#64512Nashit-h wants to merge 1 commit into
Nashit-h wants to merge 1 commit into
Conversation
Signed-off-by: Nashit-h <nashit@bugqore.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #64512 +/- ##
==========================================
- Coverage 90.24% 90.23% -0.02%
==========================================
Files 739 739
Lines 241669 241654 -15
Branches 45543 45552 +9
==========================================
- Hits 218087 218049 -38
+ Misses 15150 15134 -16
- Partials 8432 8471 +39
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CopySourceBuffer sizes its destination for whole UChar units (source_length / sizeof(UChar)) but memcpy's the raw byte length, so Buffer.transcode() of an odd-length utf16le buffer into latin1/ascii writes one byte past the conversion buffer, on both the on-stack and the heap path. Copy only the whole code units so a trailing half byte is ignored; ucnv_fromUChars already consumes length_in_chars units, so the extra byte was never read back. Added an odd-length case to test-icu-transcode.js that trips ASAN on the current code.